package com.example.demotest_day29.service.iml;

import com.example.demotest_day29.Dao.UserDao;
import com.example.demotest_day29.entity.User;
import com.example.demotest_day29.service.LonginService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;

@Slf4j
public class LoginServuceIml implements LonginService {
    @Autowired
    UserDao userDao;

    @Override
    public boolean login(String username, String password) {
        User user=userDao.getUserByName(username);
        if (user==null){
            log.info("不存在");
            return false;
        } else if (user.getPassword().equals(password)) {
            log.info("success");
            return true;
        }
        log.info("失败");
        return false;
    }


}
